package com.loser.search.service.impl;

import com.loser.search.entity.OptLog;
import com.loser.search.mapper.OptLogMapper;
import com.loser.search.service.DocumentService;
import org.dromara.easyes.core.conditions.select.LambdaEsQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DocumentServiceImpl implements DocumentService {

    @Autowired
    private OptLogMapper optLogMapper;

    @Override
    public Boolean save(OptLog log) {
        return optLogMapper.insert(log) > 0;
    }

    @Override
    public List<OptLog> listByUserId(Long userId) {

        LambdaEsQueryWrapper<OptLog> wrapper = new LambdaEsQueryWrapper<>();
        wrapper.eq(OptLog::getUserId, userId);
        return optLogMapper.selectList(wrapper);

    }

}
